function isInteger(str) {
	if (/[^\d]+$/.test(str)) {
		return false;
	}
	return true;
}
function isValidDate(iY, iM, iD) {
	var a = new Date(iY, iM - 1, iD);
	var y = a.getFullYear();
	var m = a.getMonth() + 1;
	var d = a.getDate();
	if (y != iY || m != iM || d != iD)
		return false;
	return true
}

export function filteremoji(content){
  var ranges = [
    '\ud83c[\udf00-\udfff]',
    '\ud83d[\udc00-\ude4f]',
    '\ud83d[\ude80-\udeff]'
];
 let emojireg = content .replace(new RegExp(ranges.join('|'), 'g'), '');
return emojireg;
}
export function adapter(){
  return new Promise((resolve,reject)=>{
    let arr=["iPhone XR","iPhone 11<iPhone12,1>","iPhone X","iPhone XS Max"]
    
    wx.getSystemInfo({
      success: (res) => {
        console.log(res)
        if(arr.indexOf(res.model) > -1) {
          let flg = true
          resolve(flg)
        }else{
          let flg =false
          resolve(flg)
        }
      },
    })
  })
  
}
//判断是否是正确的身份证号码
export  function isIDCard(StrNo) {
	StrNo = StrNo.toString()
	if (StrNo.length == 18) {
		var a, b, c
		if (!isInteger(StrNo.substr(0, 17)))
			return false;

		a = parseInt(StrNo.substr(0, 1)) * 7 + parseInt(StrNo.substr(1, 1)) * 9 + parseInt(StrNo.substr(2, 1)) * 10;
		a = a + parseInt(StrNo.substr(3, 1)) * 5 + parseInt(StrNo.substr(4, 1)) * 8 + parseInt(StrNo.substr(5, 1)) * 4;
		a = a + parseInt(StrNo.substr(6, 1)) * 2 + parseInt(StrNo.substr(7, 1)) * 1 + parseInt(StrNo.substr(8, 1)) * 6;
		a = a + parseInt(StrNo.substr(9, 1)) * 3 + parseInt(StrNo.substr(10, 1)) * 7 + parseInt(StrNo.substr(11, 1)) * 9;
		a = a + parseInt(StrNo.substr(12, 1)) * 10 + parseInt(StrNo.substr(13, 1)) * 5 + parseInt(StrNo.substr(14, 1)) * 8;
		a = a + parseInt(StrNo.substr(15, 1)) * 4 + parseInt(StrNo.substr(16, 1)) * 2;
		b = a % 11;

		if (b == 2)
			c = StrNo.substr(17, 1).toUpperCase(); //转为大写X 
		else
			c = parseInt(StrNo.substr(17, 1));

		switch (b) {
			case 0:
				if (c != 1)
					return false;
				break;
			case 1:
				if (c != 0)
					return false;
				break;
			case 2:
				if (c != "X")
					return false;
				break;
			case 3:
				if (c != 9)
					return false;
				break;
			case 4:
				if (c != 8)
					return false;
				break;
			case 5:
				if (c != 7)
					return false;
				break;
			case 6:
				if (c != 6)
					return false;
				break;
			case 7:
				if (c != 5)
					return false;
				break;
			case 8:
				if (c != 4)
					return false;
				break;
			case 9:
				if (c != 3)
					return false;
				break;
			case 10:
				if (c != 2)
					return false;
		}
	}
	else //15位身份证号 
	{
		if (!isInteger(StrNo))
			return false;
	}

	switch (StrNo.length) {
		case 15:
			if (isValidDate("19" + StrNo.substr(6, 2), StrNo.substr(8, 2), StrNo.substr(10, 2)))
				return true;
			else
				return false;
		case 18:
			if (isValidDate(StrNo.substr(6, 4), StrNo.substr(10, 2), StrNo.substr(12, 2)))
				return true;
			else
				return false;
	}

	return false
}

